﻿@using Newtouch.Infrastructure.Model
@{
    ViewBag.Title = "切换药房";
    Layout = "~/Views/Shared/_Form.cshtml";
    var lt = (ViewBag.yfbmList as List<LoginUserCurrentYfbmModel>) ?? new List<LoginUserCurrentYfbmModel>();
}

<ul class="list-group">
    @foreach (LoginUserCurrentYfbmModel t in lt)
    {
        <li class="list-group-item" style="text-align: center;">
            <a data-id="@t.yfbmCode" data-leve=@t.yfbmjb data-mzzy=@t.mzzybz style="width: 100%;display: block;cursor: pointer;">@t.yfbmmc</a>
        </li>
    }
</ul>
<script type="text/javascript">
    $('li.list-group-item a').click(function () {
        SwithUserPharmacy($(this).attr('data-id'), $(this).attr('data-mzzy'), $(this).attr('data-leve'), $(this).html());
    });

    function SwithUserPharmacy(yfbmCode, mzzybz, yfbmjb, yfbmmc) {
        $.najax({
            url: "/Home/SetUserPharmacy",
            data: { yfbmCode: yfbmCode, mzzybz: mzzybz, yfbmjb: yfbmjb, yfbmmc: yfbmmc },
            type: "post",
            dataType: "json",
            success: function (data) {
                top.top.location.href = top.top.location.href;
            }
        });
    }
</script>

